﻿@{
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>@ViewBag.Title</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" href="~/Styles/demo.css" />
    <script src="~/scripts/boot.js" type="text/javascript"></script>
</head>
<body>
    <div style="width: 100%">
        <div class="mini-toolbar" style="border-bottom: 0; padding: 0px;">
           @RenderSection("toolbar", required: false)
        </div>
    </div>
    <div class="mini-fit">
        @RenderBody()
    </div>
    <script type="text/javascript">
        mini.parse();


        var grid = mini.get("datagrid1");


        grid.load();
        //对"createtime"字段，进行降级排序
        grid.sortBy("Id", "desc");


        $("#key").bind("keydown", function (e) {
            if (e.keyCode == 13) {
                search();
            }
        });

        

        function onActionRenderer(e) {
            var grid = e.sender;
            var record = e.record;
            var uid = record.Id;
            var rowIndex = e.rowIndex;
            if (record.IfExamine) {
                if (record.IfExamine == "1") {
                    return "";
                }
            }

            var s = ' <a class="Edit_Button" href="javascript:editRow(\'' + uid + '\')" >编辑</a>'
                + ' <a class="Delete_Button" href="javascript:if(confirm(\'确定要删除这条记录吗？\')){deleteItem(\'' + uid + '\')}">删除</a>';
            return s;
        }

        function onNoExamActionRenderer(e) {
            var grid = e.sender;
            var record = e.record;
            var uid = record.Id;
            var rowIndex = e.rowIndex;

            var s = ' <a class="Edit_Button" href="javascript:editRow(\'' + uid + '\')" >编辑</a>'
                + ' <a class="Delete_Button" href="javascript:if(confirm(\'确定要删除这条记录吗？\')){deleteItem(\'' + uid + '\')}">删除</a>';
            return s;
        }

        function remove() {
            var rows = grid.getSelecteds();
            if (rows.length > 0) {
                if (confirm("确定删除选中记录？")) {
                    var ids = [];
                    for (var i = 0, l = rows.length; i < l; i++) {
                        var r = rows[i];
                        ids.push(r.Id);
                    }
                    var id = ids.join(',');
                    grid.loading("操作中，请稍后......");
                    deleteItem(id);
                }
            } else {
                alert("请选中一条记录");
            }
        }

    </script>
    @RenderSection("script", required: false)
</body>
</html>
